﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace GameWP
{
    public class BombTrap : Trap
    {
#region Properties
#endregion

#region Methods
        public override bool  CheckAttackWith(Character characterIsAttacked, GameTime gametime)
        {
            return base.CheckAttackWith(characterIsAttacked, gametime);
        }

        public override void EffectOnZombie(Character chracterIsAttacked)
        {
            _state = State.Fight;
            chracterIsAttacked.Hp -= this.Damage;
        }
#endregion

#region Initiation
        public BombTrap(List<Texture2D> listTextures,
            Vector2 posotion, 
            int damage,
            int timeLive,
            float delay,
            int price,
            float scaleTexture):base(listTextures, posotion, damage, timeLive, delay, price, scaleTexture)
            
        {
            _listTextures = listTextures;
            _position = posotion;
            _damage = damage;
            _timeLive = timeLive; _countTimeLive = 0;
            _delay = delay;
            _price = price;
            _scaleTexture = scaleTexture;
            _scaleRect = -20;
            _rectangle = new Rectangle
                ((int)_position.X, (int)_position.Y, _listTextures[0].Width - 10, _listTextures[0].Height - 10);
            _indexTexture = 0;
            _state = State.Move;
        }
#endregion

#region Update & Draw
        public override void Update(GameTime gametime, Vector2 position)
        {
            base.Update(gametime,position);
            if (_state == State.Move) _indexTexture = 0;
            if (this.IndexTexture == 2 && ManagerGame.SoundOn)
                ManagerGame.managerSound._explosion.Play();
        }

       public override void  Draw(SpriteBatch spritebatch, GameTime gametime)
        {
 	         base.Draw(spritebatch, gametime);
        }
#endregion
    }
}
